#include <stdio.h>
//分析:https://blog.csdn.net/p715306030/article/details/112450248
void hanoi(int n,char x,char y,char z){
    if(n==1){
        printf("%c->%c\n", x, z);
    }else{
        hanoi(n - 1, x, z, y);
        printf("%c->%c\n", x, z);
        hanoi(n - 1, y, x, z);
    }
}

int main(int argc, char *argv[]) {

    int n;
    scanf("%d", &n);
    hanoi(n, 'A', 'B', 'C');

    return 0;
}